package oop.core.view;

import java.awt.CardLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Point;

/** 
 * Holds a Component array of all the panels in the game
 *
 */

public class MainPanel extends SizeablePanel {

	private static final Dimension SIZE = new Dimension(1000, 800);
	private static final Point LOCATION = new Point(0, 0);
	
	private CardLayout cardLayout;
	
	public MainPanel()
	{
		this(new CardLayout());
	}
	
	public MainPanel(CardLayout cardLayout)
	{
		super(LOCATION, SIZE);
		
		this.setLayout(cardLayout);
		this.cardLayout = cardLayout;
	}
	
	public void changePanel(String name)
	{
		cardLayout.show(this, name);
//		repaint();
	}
	
	protected void paintComponent(Graphics g)
	{
//		System.out.println("Painting MainPanel");
		Component[] parts = getComponents();
		for(Component c : parts)
		{
			c.repaint();
		}
	}
}
